package com.cn.pack.controller;

import com.cn.pack.feign.FileFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = "/file")
public class FileController {

    @Resource
    private FileFeignService fileFeignService;

    @RequestMapping(path = "/upload", method = RequestMethod.POST)
    public String upload(@RequestPart(name = "file") MultipartFile file) {
        String result = fileFeignService.upload(file);
        System.out.println("result = " + result);
        return result;
    }
}
